package service;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
//[V] I didn't make changes there
public class MessageHandler {
	private ObjectOutputStream out;
	private ObjectInputStream in;
	
	public MessageHandler(ObjectOutputStream out, ObjectInputStream in) {
		this.in = in;
		this.out = out;
	}
	
	public void sendMessage(final String msg) throws IOException {
		out.writeObject(msg);
		out.flush();
	}

	public String readMessage() throws IOException, ClassNotFoundException {
        String message = null;
		
        message = (String) in.readObject();
		
		return message;
		
	}
}
